﻿using FastCloud.Base.Attribute;
using FastCloud.Base.Config;
using FastIOC.Attribute;
using FastUtil.Convert;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FastCloud.Base
{
    [Component]
    [TokenAuth]
    public class BaseController : Controller
    {
        public BaseController()
        {

        }

        public object GetFormParam(string ParamName)
        {
            StringValues ParamValues;
            CloudContext.Current.Request.Form.TryGetValue(ParamName, out ParamValues);
            if (ParamValues.Count>0)
            {
                return ParamValues[0];
            }
            else
            {
                return null;
            }
        }
        public object GetRequestParam(string ParamName)
        {
            StringValues ParamValues;
            CloudContext.Current.Request.Query.TryGetValue(ParamName, out ParamValues);
            if (ParamValues.Count > 0)
            {
                return ParamValues[0];
            }
            else
            {
                return null;
            }
        }
    }
}
